import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/pages/Index'
import Products from '@/components/pages/Products'
import MobileCrusher from '@/components/pages/Mobile-Crusher'
import CrushingPlant from '@/components/pages/Crushing-Plant'
import GrindingMIll from '@/components/pages/Grinding-MIll'
import ScreeningWashing from '@/components/pages/Screening-Washing'
import OreBenefication from '@/components/pages/Ore-Benefication'
import AsiaCases from '@/components/pages/Asia-Cases'
import EuropeCases from '@/components/pages/Europe-Cases'
import AfricaCases from '@/components/pages/Africa-Cases'
import NorthAmericaCases from '@/components/pages/NorthAmerica-Cases'
import LatinAmericaCases from '@/components/pages/LatinAmerica-Cases'
import OceaniaCases from '@/components/pages/Oceania-Cases'
import Company from '@/components/pages/Company-List'
import Industry from '@/components/pages/Industry-List'
import Faq from '@/components/pages/Faq-List'
import Exhibition from '@/components/pages/Exhibition-List'
import SpecList from '@/components/pages/Spec-List'
import productContent from '@/components/pages/ProductArticle'
import CaswArticle from '@/components/pages/CaseArticle'
import news from '@/components/pages/news'
import newsArticle from '@/components/pages/news-article'
import ExnewsArticle from '@/components/pages/ExhibitionNews-article'
import Service from '@/components/pages/Service'
import About from '@/components/pages/About'
import Contact from '@/components/pages/Contact'
import SolutionDifferent from '@/components/pages/Solution-Different'
import SolutionGrindingPlant from '@/components/pages/Solution-Grinding_plant'
import SolutionOreBeneficiation from '@/components/pages/Solution-Ore_beneficiation'
import SolutionSandMaking from '@/components/pages/Solution-Sand_making'
import SolutionArticle from '@/components/pages/SolutionArticle'
import Notfound from '@/components/common/Notfound'

Vue.use(Router)

let router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: Index,
      name: 'Home',
      meta: {
        title: 'Kefid - Crushing,Mobile Crusher,Grinding,Screening and Washing Plant,Mobile Crushing Plant - Kefid Machinery'
      }
    },
    {
      path: '/products',
      component: Products,
      name: 'Products',
      meta: {
        title: 'Stationary Crushers,Mobile Crushing Plant,Crushing Machine-Kefid Machinery'
      }
    },
    {
      path: '/products/Mobile-Crusher',
      component: MobileCrusher,
      name: 'MobileCrusher',
      meta: {
        title: 'Mobile Crusher,Mobile Crushing Plant,Crawler mobile crusher,-Kefid Machinery'
      }
    },
    {
      path: '/products/Crushing-Plant',
      component: CrushingPlant,
      name: 'CrushingPlant',
      meta: {
        title: 'Crusher machine,fixed Crusher Machine, stationary Crushing P-Kefid Machinery'
      }
    },
    {
      path: '/products/Grinding-MIll',
      component: GrindingMIll,
      name: 'GrindingMIll',
      meta: {
        title: 'Grinding Mill,Grinding Machine,Industrial Mill,Crusher Mill-Kefid Machinery'
      }
    },
    {
      path: '/products/Screening-Washing',
      component: ScreeningWashing,
      name: 'ScreeningWashing',
      meta: {
        title: 'Vibrating Screen,Sand Washing Machine,Belt conveyor,Vibratio-Kefid Machinery'
      }
    },
    {
      path: '/products/Ore-Benefication',
      component: OreBenefication,
      name: 'OreBenefication',
      meta: {
        title: 'Ore beneficiation,Ore processing plant,Ore processing-Kefid Machinery'
      }
    },
    {
      path: '/AsiaCases',
      component: AsiaCases,
      name: 'AsiaCases',
      meta: {
        title: 'Stone Crusher Asia,Mobile Stone Crusher Indonesia-Kefid Machinery'
      }
    },
    {
      path: '/EuropeCases',
      component: EuropeCases,
      name: 'EuropeCases',
      meta: {
        title: 'Crushing Machine For Stone Europe,Stone Crusher Plant-Kefid Machinery'
      }
    },
    {
      path: '/AfricaCases',
      component: AfricaCases,
      name: 'AfricaCases',
      meta: {
        title: 'Stone Crusher Machine Africa,Limestone Crushing Plant Kenya-Kefid Machinery'
      }
    },
    {
      path: '/NorthAmericaCases',
      component: NorthAmericaCases,
      name: 'NorthAmericaCases',
      meta: {
        title: 'Stone Crusher Price,Stone Crusher Plant,Mobile Stone Crusher-Kefid Machinery'
      }
    },
    {
      path: '/LatinAmericaCases',
      component: LatinAmericaCases,
      name: 'LatinAmericaCases',
      meta: {
        title: 'Stone Crusher Machine For Sale,Stone Crusher Types-Kefid Machinery'
      }
    },
    {
      path: '/OceaniaCases',
      component: OceaniaCases,
      name: 'OceaniaCases',
      meta: {
        title: 'Stone Crushing And Screening Plant,Mobile Stone Crushers -Kefid Machinery'
      }
    },
    {
      path: '/News/Company/',
      component: Company,
      name: 'Company',
      meta: {
        title: 'Company News, Company News List-Kefid Machinery'
      }
    },
    {
      path: '/News/Industry/',
      component: Industry,
      name: 'Industry',
      meta: {
        title: 'Industry news-Kefid Machinery'
      }
    },
    {
      path: '/News/Faq/',
      component: Faq,
      name: 'Faq',
      meta: {
        title: 'FAQ-Kefid Machinery'
      }
    },
    {
      path: '/News/Exhibition/',
      component: Exhibition,
      name: 'Exhibition',
      meta: {
        title: 'Exhibition-Kefid Machinery'
      }
    },
    {
      path: '/News/special/',
      component: SpecList,
      name: 'SpecList',
      meta: {
        title: 'Special Report News -Kefid Machinery'
      }
    },
    {
      path: '/service',
      component: Service,
      name: 'Service',
      meta: {
        title: 'Service and Support_Kefid Machinery'
      }
    },
    {
      path: '/about',
      component: About,
      name: 'About',
      meta: {
        title: 'Who we are_Kefid Machinery'
      }
    },
    {
      path: '/contact',
      component: Contact,
      name: 'Contact',
      meta: {
        title: 'Contact Us-Kefid Machinery'
      }
    },
    {
      path: '/case/:caseId/',
      component: CaswArticle,
      name: 'CaswArticle',
      meta: {
        title: ''
      }
    },
    {
      path: '/product/:productId',
      component: productContent,
      name: 'productContent',
      meta: {
        title: ''
      }
    },
    {
      path: '/solution/different',
      component: SolutionDifferent,
      name: 'SolutionDifferent',
      meta: {
        title: 'Aggregate crushing plant,mobile stone crushing plant, gravel-Kefid Machinery'
      }
    },
    {
      path: '/solution/grinding_plant',
      component: SolutionGrindingPlant,
      name: 'SolutionGrindingPlant',
      meta: {
        title: 'Mineral Grinding plant,Grinding Machine,Mineral Grinding Mil-Kefid Machinery'
      }
    },
    {
      path: '/solution/ore-beneficiation',
      component: SolutionOreBeneficiation,
      name: 'SolutionOreBeneficiation',
      meta: {
        title: 'Ore beneficiation plant, iron ore,gold ore,copper ore crushe-Kefid Machinery'
      }
    },
    {
      path: '/solution/sand-making',
      component: SolutionSandMaking,
      name: 'SolutionSandMaking',
      meta: {
        title: 'Manufactured Sand Making Machine, Sand Making Plant, Sand cr-Kefid Machinery'
      }
    },
    {
      path: '/News/:newsId',
      component: newsArticle,
      name: 'newsArticle',
      meta: {
        title: ''
      }
    },
    {
      path: '/solution/:solutId',
      component: SolutionArticle,
      name: 'SolutionArticle',
      meta: {
        title: ''
      }
    },
    {
      path: '/ExNews/:ExnewsId',
      component: ExnewsArticle,
      name: 'ExnewsArticle',
      meta: {
        title: ''
      }
    },
    {
      path: '/news',
      component: news,
      name: 'news',
      meta: {
        title: ''
      }
    },
    {
      path: '*',
      name: '404',
      component: Notfound
    }
  ]
})

router.beforeEach((to, from, next) => {
  /* let token = localStorage.getItem('access_token')
  let nowTime = new Date()
  if (to.matched.some(r => r.meta.requireAuth)) {
    if (token && (nowTime.getTime() < localStorage.getItem('expires_time') * 1000)) {
      next()
    } else {
      localStorage.clear()
      next({path: '/'})
    }
  } else {
    next()
  } */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router
